<?php
namespace app\index\controller;
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
use League\Flysystem\FilesystemException;
use think\Controller;
use think\Model ;
use Mobile_Detect;
use Carbon\Carbon;

//https://flysystem.thephpleague.com/v1/docs/usage/filesystem-api/  file 文件api
class Config extends Controller
{


    public function index(){
        //echo __DIR__;
        printf("Right now is %s", Carbon::now()->toDateTimeString());
        printf("Right now in Vancouver is %s", Carbon::now('America/Vancouver'));  //implicit __toString()
        $tomorrow = Carbon::now()->addDay();
        $lastWeek = Carbon::now()->subWeek();
        echo '明天'.$tomorrow;
        echo '上周'.$lastWeek;

        /*require_once 'Mobile_Detect.php';*/
      /*  $detect = new Mobile_Detect;$detect->isMobile();
        if($detect->isIphone())
        {
            echo '是 iphone';
        }else{
            echo '不是iphone';
        }*/



// Batch methods.
    }


    //删除 上传的文件夹  excel
   public function DelUploadExcel(){
        $adapter = new Local(
        // Determine root directory
            DS.'public\uploads'
        );
        $filesystem = new Filesystem($adapter);

        $contents = $filesystem->listContents('\instrument', true);
        dd($contents);
    }
    public function WriteTest(){
        $adapter = new Local(
        // Determine root directory
            THINK_PATH.'/'
        );
        $filesystem = new Filesystem($adapter);

        try {
            $filesystem->write('ac.txt', '111');
            echo 'success';
        } catch (FilesystemException | UnableToWriteFile $exception) {
            // handle the error
            echo 'error';
        }
    }

}